package cn.monkey.family.server.domain.uc.role.resource;

import cn.monkey.family.data.crud.repository.CrudRepository;
import cn.monkey.family.data.uc.role.resource.QRoleResources;
import cn.monkey.family.data.uc.role.resource.RoleResources;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.NoRepositoryBean;

import java.util.Optional;

@NoRepositoryBean
public interface RoleResourceRelRepository extends CrudRepository<RoleResources, String>,
        QuerydslPredicateExecutor<RoleResources> {
    default Optional<RoleResources> selectByRoleId(String roleId) {
        QRoleResources roleResources = QRoleResources.roleResources;
        return this.findOne(roleResources.roleId.eq(roleId));
    }

}
